import fetch from 'common/src/utils/fetch'
let apiPrefix = '/api/studentservice/';

// 考核规则查询列表
export function assessRulesSettingList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/assessRulesSettingList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核规则新增
export function insertRulesSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/insertRulesSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//考核规则删除
export function deleteRulesSetting(data = []) {
    return fetch({
        url: apiPrefix + 'assessSetting/deleteRulesSetting',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//考核规则修改
export function updateRulesSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/updateRulesSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核规则获取详情
export function rulesSettingDetail(data = {}) {
    return fetch({
        url: apiPrefix + `assessSetting/rulesSettingDetail`,
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}


// 考核时间查询列表
export function assessTimeSettingList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/assessTimeSettingList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 查询规则名称集合
export function assessRulesSettingAllList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/assessRulesSettingAllList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核时间规则新增
export function insertTimeSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/insertTimeSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//考核时间规则删除
export function deleteTimeSetting(data = []) {
    return fetch({
        url: apiPrefix + 'assessSetting/deleteTimeSetting',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//考核时间规则修改
export function updateTimeSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/updateTimeSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核时间规则获取详情
export function timeSettingDetail(data = {}) {
    return fetch({
        url: apiPrefix + `assessSetting/timeSettingDetail?id=${data.id}`,
        method: 'get',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核批次查询列表
export function assessTopicBatchList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessTopic/assessTopicBatchList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核批次新增
export function insertAssessTopicBatch(data = {}) {
    return fetch({
        url: apiPrefix + 'assessTopic/insertAssessTopicBatch',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//考核批次删除
export function deleteAssessTopicBatch(data = []) {
    return fetch({
        url: apiPrefix + 'assessTopic/deleteAssessTopicBatch',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//考核批次修改
export function updateAssessTopicBatch(data = {}) {
    return fetch({
        url: apiPrefix + 'assessTopic/updateAssessTopicBatch',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核批次获取详情
export function assessTopicBatchDetail(id) {
    return fetch({
        url: apiPrefix + 'assessTopic/assessTopicBatchDetail?topicBatchId='+id,
        method: 'get',
        headers: { 'Content-Type': 'application/json' }
    })
}


// 考核画像/成绩录入查询列表
export function assessPaperList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/assessPaperList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//成绩录入批量发布
export function updateAssessScoreStatus(calendarId, val, faculty) {
    return fetch({
        url: apiPrefix + 'assessPaper/updateAssessScoreStatus?calendarId='+calendarId+'&trainingLevel='+val+'&faculty='+faculty,
        method: 'get',
        headers: { 'Content-Type': 'application/json' }
    })
}

//在职成绩发布
export function batcchRelease(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/topicBatch/release',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//成绩修改
export function updateAssessScore(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/updateAssessScore',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 考核画像获取详情
export function assessPaperDetail(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/assessPaperDetail',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 查询考核批次维护-添加学生/未添加学生
export function selectAssessStudentList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/selectAssessStudentList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
/*获取批次名单列表*/
export function findBatchNameList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessTopic/findBatchNameList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 查询考核批次维护-添加学生/刪除学生
export function updateAssessStudentIsAdd(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/updateAssessStudentIsAdd',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 查询课程集合
export function getCourseList(data = {}) {
    return fetch({
        url: apiPrefix + 'assessSetting/getCourseList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 统计硕士/博士成绩占比
export function assessScoreData(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/assessScoreData',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

/**
 * @param data
 * 中期考核成绩数据导出
 */
export function exportScoreData(data = {}) {
    return fetch({
        url: apiPrefix + 'assessPaper/exportScoreData',
        method: 'post',
        headers: {'Content-Type': 'application/json'},
        data
    })
}

export default {
    assessRulesSettingList,
    assessRulesSettingAllList,
    insertRulesSetting,
    deleteRulesSetting,
    updateRulesSetting,
    rulesSettingDetail,
    insertTimeSetting,
    deleteTimeSetting,
    updateTimeSetting,
    timeSettingDetail,
    assessTopicBatchList,
    insertAssessTopicBatch,
    deleteAssessTopicBatch,
    updateAssessTopicBatch,
    assessTopicBatchDetail,
    assessPaperList,
    updateAssessScoreStatus,
    updateAssessScore,
    batcchRelease,
    assessPaperDetail,
    selectAssessStudentList,
    findBatchNameList,
    updateAssessStudentIsAdd,
    getCourseList,assessScoreData,exportScoreData
}
